package com.web.common.enums;

/**
 * @author wenzhuo
 * @create 2024-03-29 2024/3/29
 */
public enum BuyOrSell {

        B("B", "Buy"),
        S("S", "Sell"),
        ;
        // 成员变量
        private String direction;
        private String description;
        // 构造方法
        private BuyOrSell(String direction, String description) {
            this.direction = direction;
            this.description = description;
        }

        // 普通方法
        public static String generateDescription(String direction) {
            for (BuyOrSell buyOrSell: BuyOrSell.values()) {
                if (direction.equals(buyOrSell.getDirection())) {
                    return buyOrSell.getDescription();
                }
            }
            return null;
        }

        public String getDirection() {
            return direction;
        }

        public void setDirection(String direction) {
            this.direction = direction;
        }

        public String getDescription() {
            return description;
        }

        public void setDescription(String description) {
            this.description = description;
        }
}
